<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>libBigWig: io.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">libBigWig
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">io.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;curl/curl.h&gt;</code><br/>
<code>#include &lt;stdio.h&gt;</code><br/>
<code>#include &lt;stdlib.h&gt;</code><br/>
<code>#include &lt;string.h&gt;</code><br/>
<code>#include &quot;<a class="el" href="io_8h_source.html">io.h</a>&quot;</code><br/>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a78573a5f8a08194fa115f2f537615401"><td class="memItemLeft" align="right" valign="top">CURLcode&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a78573a5f8a08194fa115f2f537615401">urlFetchData</a> (<a class="el" href="structURL__t.html">URL_t</a> *URL)</td></tr>
<tr class="separator:a78573a5f8a08194fa115f2f537615401"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a519f7aef65e8d74af3afc297f197fe29"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a519f7aef65e8d74af3afc297f197fe29">url_fread</a> (void *obuf, size_t obufSize, <a class="el" href="structURL__t.html">URL_t</a> *URL)</td></tr>
<tr class="separator:a519f7aef65e8d74af3afc297f197fe29"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8f6a5aa097c9af9925171dd43d688f26"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a8f6a5aa097c9af9925171dd43d688f26">urlRead</a> (<a class="el" href="structURL__t.html">URL_t</a> *URL, void *buf, size_t bufSize)</td></tr>
<tr class="memdesc:a8f6a5aa097c9af9925171dd43d688f26"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads data into the given buffer.  <a href="#a8f6a5aa097c9af9925171dd43d688f26">More...</a><br/></td></tr>
<tr class="separator:a8f6a5aa097c9af9925171dd43d688f26"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a55a1fcb43f68a2b3c3a2b66a6459a0a8"><td class="memItemLeft" align="right" valign="top">CURLcode&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a55a1fcb43f68a2b3c3a2b66a6459a0a8">urlSeek</a> (<a class="el" href="structURL__t.html">URL_t</a> *URL, size_t pos)</td></tr>
<tr class="memdesc:a55a1fcb43f68a2b3c3a2b66a6459a0a8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Seeks to a given position in a local or remote file.  <a href="#a55a1fcb43f68a2b3c3a2b66a6459a0a8">More...</a><br/></td></tr>
<tr class="separator:a55a1fcb43f68a2b3c3a2b66a6459a0a8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4954d46c5299f7ae81fd3e6f34e72b74"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structURL__t.html">URL_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a4954d46c5299f7ae81fd3e6f34e72b74">urlOpen</a> (char *fname)</td></tr>
<tr class="separator:a4954d46c5299f7ae81fd3e6f34e72b74"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:add8705cdab8e6f2193a50bf095f08470"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#add8705cdab8e6f2193a50bf095f08470">urlClose</a> (<a class="el" href="structURL__t.html">URL_t</a> *URL)</td></tr>
<tr class="separator:add8705cdab8e6f2193a50bf095f08470"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7dff7d19c1f094d5ff6a88553badffe0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#a7dff7d19c1f094d5ff6a88553badffe0">bwSetPos</a> (<a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *fp, size_t pos)</td></tr>
<tr class="separator:a7dff7d19c1f094d5ff6a88553badffe0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adc16c73076856035477e460ea4ea3d17"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#adc16c73076856035477e460ea4ea3d17">bwRead</a> (void *data, size_t sz, size_t nmemb, <a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *fp)</td></tr>
<tr class="separator:adc16c73076856035477e460ea4ea3d17"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae9041b92bc3f69533fe6dc1711bbf485"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#ae9041b92bc3f69533fe6dc1711bbf485">bwClose</a> (<a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *fp)</td></tr>
<tr class="separator:ae9041b92bc3f69533fe6dc1711bbf485"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa01bfecb84cb73b3d6696fcc76e2259c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#aa01bfecb84cb73b3d6696fcc76e2259c">bwInit</a> (size_t defaultBufSize, int nFetchIterations, unsigned int nSeconds)</td></tr>
<tr class="separator:aa01bfecb84cb73b3d6696fcc76e2259c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad6f947e93ecf0e03c4ee2d8c3e852d61"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="io_8c.html#ad6f947e93ecf0e03c4ee2d8c3e852d61">bwCleanup</a> ()</td></tr>
<tr class="separator:ad6f947e93ecf0e03c4ee2d8c3e852d61"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ad6f947e93ecf0e03c4ee2d8c3e852d61"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void bwCleanup </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="ae9041b92bc3f69533fe6dc1711bbf485"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void bwClose </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *&#160;</td>
          <td class="paramname"><em>fp</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="aa01bfecb84cb73b3d6696fcc76e2259c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int bwInit </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>defaultBufSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>nFetchIterations</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>nSeconds</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="adc16c73076856035477e460ea4ea3d17"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t bwRead </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>sz</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>nmemb</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *&#160;</td>
          <td class="paramname"><em>fp</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a7dff7d19c1f094d5ff6a88553badffe0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int bwSetPos </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structbigWigFile__t.html">bigWigFile_t</a> *&#160;</td>
          <td class="paramname"><em>fp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>pos</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a519f7aef65e8d74af3afc297f197fe29"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t url_fread </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>obuf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>obufSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structURL__t.html">URL_t</a> *&#160;</td>
          <td class="paramname"><em>URL</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="add8705cdab8e6f2193a50bf095f08470"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void urlClose </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structURL__t.html">URL_t</a> *&#160;</td>
          <td class="paramname"><em>URL</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a78573a5f8a08194fa115f2f537615401"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">CURLcode urlFetchData </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structURL__t.html">URL_t</a> *&#160;</td>
          <td class="paramname"><em>URL</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a4954d46c5299f7ae81fd3e6f34e72b74"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structURL__t.html">URL_t</a>* urlOpen </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>fname</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a8f6a5aa097c9af9925171dd43d688f26"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t urlRead </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structURL__t.html">URL_t</a> *&#160;</td>
          <td class="paramname"><em>URL</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>bufSize</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reads data into the given buffer. </p>
<p>This function will store bufSize data into buf for both local and remote files. For remote files an internal buffer is used to store a (typically larger) segment of the remote file.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">URL</td><td>A <a class="el" href="structURL__t.html">URL_t</a> * pointing to a valid opened file or remote URL. </td></tr>
    <tr><td class="paramname">buf</td><td>The buffer in memory that you would like filled. It must be able to hold bufSize bytes! </td></tr>
    <tr><td class="paramname">bufSize</td><td>The number of bytes to transfer to buf.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns the number of bytes stored in buf, which should be bufSize on success and something else on error.</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>Note that on error, URL for remote files is left in an unusable state. You can get around this by running <a class="el" href="io_8h.html#a55a1fcb43f68a2b3c3a2b66a6459a0a8" title="Seeks to a given position in a local or remote file. ">urlSeek()</a> to a position outside of the range held by the internal buffer. </dd></dl>

</div>
</div>
<a class="anchor" id="a55a1fcb43f68a2b3c3a2b66a6459a0a8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">CURLcode urlSeek </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structURL__t.html">URL_t</a> *&#160;</td>
          <td class="paramname"><em>URL</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>pos</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Seeks to a given position in a local or remote file. </p>
<p>For local files, this will set the file position indicator for the file pointer to the desired position. For remote files, it sets the position to start downloading data for the next <a class="el" href="io_8h.html#a8f6a5aa097c9af9925171dd43d688f26" title="Reads data into the given buffer. ">urlRead()</a>. Note that for remote files that running <a class="el" href="io_8h.html#a55a1fcb43f68a2b3c3a2b66a6459a0a8" title="Seeks to a given position in a local or remote file. ">urlSeek()</a> with a pos within the current buffer will simply modify the internal offset.</p>
<dl class="section return"><dt>Returns</dt><dd>CURLE_OK on success and a different CURLE_XXX on error. For local files, the error return value is always CURLE_FAILED_INIT </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Aug 5 2015 14:17:20 for libBigWig by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>
